package com.bw.biz.controller;


import com.bw.biz.pojo.TbOrder;
import com.bw.biz.pojo.TbProduct;
import com.bw.biz.service.TbOrderService;
import com.bw.biz.service.TbProductService;
import com.bw.biz.vo.ProductVo;
import com.bw.core.result.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.transform.Result;
import java.util.List;

/**
 * <p>
 * 申请订单表 前端控制器
 * </p>
 *
 * @author lv
 * @since 2021-03-23
 */
@RestController
@RequestMapping("/tb-order")
public class TbOrderController {
    @Autowired
    private TbOrderService orderService;
    @Autowired
    private TbProductService productService;

    //测试订单列表
    @GetMapping("/list")
    public ResponseResult list(){
        List<TbOrder> list = orderService.list();
        return ResponseResult.success(list);
    }
    //添加一条订单
    @PostMapping("addOrder")
    public ResponseResult addOrder(@RequestBody ProductVo product){
        return orderService.addOrder(product);
    }
}